package aaa.schedule.parameters;

import aaa.main.R;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.TextView;

/**
 *
 * @author Seb
 */
public class ScheduleName extends  ParameterType {
	
	public static final String FIELD_ID = "schedule_name" ;

	private String name;
	private LayoutInflater inflater;

	private TextView nameSchedule;

	public ScheduleName (LayoutInflater inflater, String name) {
		super(FIELD_ID) ;
		this.inflater = inflater ;
		this.name = name ;
	}

	public Object getValue(View view) {
		this.nameSchedule = (EditText) view.findViewById(R.id.nameSchedule) ;
		return this.nameSchedule.getText() ;
	}

	public View getView(View convertView, ViewGroup parent) {
		View v = convertView ;
		if (v == null) {
			v = this.inflater.inflate(R.layout.type_schedule_name, null) ;
		}// if
		this.nameSchedule = (EditText) v.findViewById(R.id.nameSchedule) ;
		if (this.nameSchedule == null) {
			v = this.inflater.inflate(R.layout.type_schedule_name, null) ;
		}// if

		this.nameSchedule = (EditText) v.findViewById(R.id.nameSchedule) ;
		this.nameSchedule.setFocusable(true) ;
		this.nameSchedule.setText(this.name) ;

		return v ;
	} 

}
